<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<title>Untitled Document</title>
		<script>
			
			var n = 100000, arr = [];
			for (var i=0; i<n; i++) {
				arr.push( i );	
			}
			
			var begin = new Date();
			for (var i=0; i<n; i++ ) {
				;	
			}			
			var end = new Date();
			diff1 = end.getTime() - begin.getTime();
			
			var begin2 = new Date();
			for( var i in arr ){
				;
			}		
			var end2 = new Date();		
			diff2 = end2.getTime() - begin2.getTime();
			alert( "diff1 = " + diff1 + " diff2 = " + diff2 );	
			
		</script>
	</head>
	<body>
		当一个对象属性很多时，for( var key in )采用hash的方式不如索引index的方式
	</body>
</html>
